﻿using System;
using System.Data;
using MySql.Data.MySqlClient;

namespace ChloeEx.Core.MySql
{
    public class ConsolePrinter : ICommandPrinter
    {
        public void WriteSqlString(IDbCommand command,string action)
        {
            var sql = command.CommandText;
            Console.WriteLine(action);
            foreach (MySqlParameter item in command.Parameters)
            {
                sql = sql.Replace(item.ParameterName,item.Value.ToString());                
            }
            Console.WriteLine(sql);
        }
    }
}
